﻿lastScrollY = 0;
function heartBeat() {
    var diffY;
    if (document.documentElement && document.documentElement.scrollTop)
    {
        diffY = document.documentElement.scrollTop;
    }
    else if (document.body)
    {
        diffY = document.body.scrollTop;
    }
    else {}
    //alert(diffY);
    
    percent = .1 * (diffY - lastScrollY);
    
    //alert(percent);
    if (percent > 0) {percent = Math.ceil(percent);}
    
    else {percent = Math.floor(percent);}
    
    //document.getElementById("LeftAd").style.top = parseInt(document.getElementById("LeftAd").style.top) + percent + "px";

    //document.getElementById("LeftAd").style.top = parseInt(document.getElementById("LeftAd").style.top) + percent + "px";
    document.getElementById("LeftAd").style.bottom =  percent + "px";
    
    lastScrollY = lastScrollY + percent;
    //alert(document.getElementById("LeftAd").style.top);
    //alert(lastScrollY);
}
window.setInterval("heartBeat()", 1);
/*

    <div id="LeftAd" style="overflow: visible; position: absolute; bottom: 0px;
        border: 1px solid red; width: 1014px; height: 35px; background-color: Aqua; font-size: 12px;
        float: left; margin:0px auto;">
    </div>
    
    测试代码  粘贴过去就行了  嘿嘿 我写的
*/